FORM get_data.
SELECT * FROM /B28/HDBDRCC8 INTO TABLE T_RCC8_1.
IF P_PSOID IS NOT INITIAL.
    SELECT * FROM /B28/HDBDRCC8 INTO TABLE T_RCC8 WHERE NODENAME = P_PSOID.
ELSE.
    SELECT * FROM /B28/HDBDRCC8 INTO TABLE T_RCC8 WHERE NODENAME = 'JYJH'.
ENDIF.
    
LOOP AT T_RCC8.
    W_NODEID = T_RCC8-NODEID.
    CLEAR T_RCC8.
    DO.
        LOOP AT T_RCC8_1 WHERE PARENTID = W_NODEID.
        MOVE-CORRESPONDING T_RCC8_1 TO T_RCC8.
        APPEND T_RCC8.
        ENDLOOP.
        EXIT.
        ENDDO.
ENDLOOP.

REFRESH T_RCC8_1.
T_RCC8_1[] = T_RCC8[].
LOOP AT T_RCC8.
GT_OUT-POSID = T_RCC8-NODENAME.
READ TABLE T_RCC8_1 WITH KEY NODEID = T_RCC8-PARENTID.
IF SY-SUBRC = 0.
    GT_OUT-POSID_1 = T_RCC8_1-NODENAME.
ENDIF.

SELECT SINGLE /B28/S_DBPMUYO INTO GT_OUT-LX FROM /B28/PDBDRCC8
WHERE /B28/S_DBDRCC8 = GT_OUT-POSID.

SELECT SINGLE TXTLG INTO GT_OUT-MC FROM /B28/TDBDRCC8
WHERE /B28/S_DBDRCC8 = GT_OUT-POSID.

APPEND GT_OUT.
CLEAR GT_OUT.
ENDLOOP.

SELECT * FROM ZJYJHCJ INTO TABLE T_YSJD.

LOOP AT GT_OUT ASSIGNING <FS>.
<FS>-CK = 'X'.
READ TABLE T_YSJD ASSIGNING <FS_YSJD> WITH KEY POSID = <FS>-POSID.
IF SY-SUBRC = 0.
    <FS>-CK = <FS_YSJD>-CK.
ENDIF.

READ TABLE T_OUT ASSIGNING <FS2> WITH KEY POSID = <FS>-POSID.
IF SY-SUBRC = 0.
    <FS>-CK = <FS2>-CK.
ENDIF.
ENDLOOP.

ENDFORM.